import glob
import os

import cv2

videos = glob.glob("*.mp4")
print(videos)
for video in videos:
    video_path = video.split(".")[0]
    print(video_path)
    # os.mkdir(video_path)
    video_cap = cv2.VideoCapture(video)
    frame_num = 0
    while video_cap.isOpened():
        frame_num += 1
        ret, frame = video_cap.read()
        if ret:
            if frame_num % 10 == 0:
                cv2.imwrite("{0}\\{1}_{2}.png".format(
                    video_path, video_path, str(frame_num)), frame)
        else:
            break
